﻿using System;
namespace DataStore.Domain
{
    /// <summary>
    /// Library catalog classification
    /// </summary>
    [Serializable]
    public class Classification : IEquatable<Classification>
    {
        /// <summary>
        /// Gets or sets the id.
        /// </summary>
        /// <value>The id.</value>
        public virtual Guid Id { get; set; }
        /// <summary>
        /// Gets or sets the Digital Object Identifier.
        /// </summary>
        /// <value>The DOI.</value>
        public virtual string DOI { get; set; }
        /// <summary>
        /// Gets or sets the Universal Decimal Classification.
        /// </summary>
        /// <value>The UD classification.</value>
        public virtual string UD { get; set; }
        /// <summary>
        /// Gets or sets the International Standard Bibliographic Description classification.
        /// </summary>
        /// <value>The ISBD classification.</value>
        public virtual string ISBD { get; set; }
        /// <summary>
        /// Gets or sets the  MAchine-Readable Cataloging classification.
        /// </summary>
        /// <value>The MARC classification.</value>
        public virtual string MARC { get; set; }
        /// <summary>
        /// Gets or sets the Chinese Library Classification classification.
        /// </summary>
        /// <value>The CLC classification.</value>
        public virtual string CLC { get; set; }
        /// <summary>
        /// Gets or sets the Harvard-Yenching Classification System.
        /// </summary>
        /// <value>The HY.</value>
        public virtual string HYCS { get; set; }
        /// <summary>
        /// Gets or sets the Anglo-American Cataloguing Rules.
        /// </summary>
        /// <value>The AARC.</value>
        public virtual string AARC { get; set; }
        /// <summary>
        /// Gets or sets the Dublin Core.
        /// </summary>
        /// <value>The DC.</value>
        public virtual string DC { get; set; }
        /// <summary>
        /// Gets or sets the Freinet classification.
        /// </summary>
        /// <value>The freinet.</value>
        public virtual string Freinet { get; set; }
        /// <summary>
        /// Gets or sets the National Bibliography Number.
        /// </summary>
        /// <value>The NBN.</value>
        public virtual string NBN { get; set; }

        #region Equality

        /// <summary>
        /// Equalses the specified other.
        /// </summary>
        /// <param name="other">The other.</param>
        /// <returns></returns>
        public virtual bool Equals(Classification other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return other.Id.Equals(Id);
        }

        /// <summary>
        /// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
        /// <returns>
        /// 	<c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            return Equals(obj as Classification);

        }

        /// <summary>
        /// Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. 
        /// </returns>
        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }

        /// <summary>
        /// Implements the operator ==.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static bool operator ==(Classification left, Classification right)
        {
            return Equals(left, right);
        }

        /// <summary>
        /// Implements the operator !=.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static bool operator !=(Classification left, Classification right)
        {
            return !Equals(left, right);
        }

        #endregion
    }
}
